package com.asset.dispoal.flawPool;

import com.asset.dispoal.flawPool.api.FlawPoolService;
import com.asset.dispoal.flawPool.dto.FlawPoolRequest;
import com.asset.dispoal.flawPool.dto.FlawPoolResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.mhuang.pacebox.springboot.core.permission.annotation.Permission;
import tech.mhuang.pacebox.springboot.protocol.Result;
import tech.mhuang.pacebox.springboot.protocol.data.PageVO;

/**
 * @author qr
 * @date 2022/5/23$
 */
@RestController
@RequestMapping("sys/flawPool")
@Api(value = "瑕疵池配置管理", tags = "瑕疵池配置管理")
public class FlawPoolController {


    @Autowired
    FlawPoolService flawPoolService;


    @Permission(code = "publicConfigFlaw:add")
    @PostMapping("insertFlawPool")
    @ApiOperation(value = "添加瑕疵菜单", notes = "添加瑕疵菜单")
    public Result insertFlawPool(@RequestBody FlawPoolRequest request) {
        return flawPoolService.insertFlawPool(request);
    }

    @Permission(code = "publicConfigFlaw:del")
    @PostMapping("delFlawPool")
    @ApiOperation(value = "删除瑕疵菜单", notes = "删除瑕疵菜单")
    public Result delFlawPool(@RequestBody String id) {
        return flawPoolService.delFlawPool(id);
    }


    @Permission(code = "publicConfigFlaw:update")
    @PostMapping("updateFlawPool")
    @ApiOperation(value = "修改瑕疵菜单", notes = "修改瑕疵菜单")
    public Result updateFlawPool(@RequestBody FlawPoolRequest request) {
        return flawPoolService.updateFlawPool(request);
    }


    //    @Permission(code = "publicConfigFlaw", param = "")
    @PostMapping("queryPage")
    @ApiOperation(value = "分页查询", notes = "分页查询")
    public Result<PageVO<FlawPoolResponse>> queryPage(@RequestBody FlawPoolRequest request) {
        return flawPoolService.queryFlawPool(request);
    }


}
